#include <iostream>
#include <memory>
#include <vector>
using namespace std;

void test(){
    unique_ptr<int> up(new int(10));
    cout<<up.get()<<endl;
    cout<<*up<<endl;

}
class Point{
public:
    Point(int x,int y)
    :_x(x)
    ,_y(y)
    {

    }
    void print(){
        cout<<_x<<_y<<endl;
    }
private:
    int _x;
    int _y;
};
void test1(){
    unique_ptr<Point> up(new Point(1,2));
    cout<<up.get()<<endl;
    up->print();
}
//在vector里面存储unique_ptr
void test2(){
vector<unique_ptr<Point>> vec;
unique_ptr<Point> up(new Point(0,0));
vec.push_back(std::move(up));
vec.push_back(unique_ptr<Point>(new Point(2,3)));
for(auto & ele :vec){
    ele->print();
}
}


int main(int argc, char * argv[]){
    test2();
    return 0;
}

